package com.lantosec.hmrp.modules.eval.controller.app;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lantosec.hmrp.core.kit.PageVO;
import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.core.mvc.BaseController;
import com.lantosec.hmrp.modules.eval.entity.EvalItem;
import com.lantosec.hmrp.modules.eval.entity.EvalType;
import com.lantosec.hmrp.modules.eval.service.IEvalTypeService;
import com.lantosec.hmrp.modules.eval.vo.EvalItemVO;
import com.lantosec.hmrp.modules.eval.vo.EvalTypeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

/**
 *
 * 考评项目分类定义 控制器
 *
 * @author AutoCode
 * @since 2020-03-13
 */
@Api(value = "考评项目分类定义控制器APP端", tags = "考评项目分类定义控制器APP端")
@RestController
@RequestMapping("/eval/app/type")
@Log4j2
public class EvalTypeAppController extends BaseController {
    @Autowired
    private IEvalTypeService service;


    @GetMapping("getAll")
    @ApiOperation(value = "查询全部")
    public Result<List<EvalTypeVO>> all(@ApiParam(value = "分类名称")@RequestParam(name = "evalTypeName",required = false) String evalTypeName){
        List<EvalTypeVO> evalTypeVOList = service.getAll(evalTypeName);
        return Result.ok(evalTypeVOList);
    }

    @GetMapping("getByEvalTarget")
    @ApiOperation(value = "根据被考评对象查询项目")
    public Result<List<EvalTypeVO>> getByEvalTarget(@ApiParam(value = "ID") @RequestParam(name = "evalTarget",required = false) Integer evalTarget) {
        List<EvalTypeVO> evalTypeVOList = service.getByEvalTarget(evalTarget);
        return Result.ok(evalTypeVOList);
    }

    @GetMapping("getByEvalTargetApply")
    @ApiOperation(value = "根据被考评对象查询申报项目")
    public Result<List<EvalTypeVO>> getByEvalTargetApply(@ApiParam(value = "ID") @RequestParam(name = "evalTarget",required = false) Integer evalTarget) {
        List<EvalTypeVO> evalTypeVOList = service.getByEvalTargetApply(evalTarget);
        return Result.ok(evalTypeVOList);
    }
}
